package com.example.lishop.repository

import com.example.lishop.entity.BTestEntity
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Modifying
import org.springframework.data.jpa.repository.Query
import org.springframework.transaction.annotation.Transactional

/**
 * Created on 2021/3/14 18:00
 * @author shuguo
 */
interface TestRepository : JpaRepository<BTestEntity, Int>{

    //nativeQuery = true 表明sql语句，false表明hql语句，默认值是false
    @Transactional(timeout = 10)
    @Modifying
    @Query("update BTestEntity set sts = '1' where id = ?1"/*, nativeQuery = true*/)
    fun del(depId: Int)

    @Transactional(timeout = 10)
    @Modifying
    @Query("update BTestEntity set name = :name where id = :id")
    fun update(id:Int, name:String)
}